BitMask
BitMask allows more complex bitwise facility code and card number decoding.
Note: The BitMask and DigitMask options cannot be used together for a given card type. (If both are accidentally specified then only the DigitMask option will be used).
BitMask=-----pffffffffffffffcccccccccccccccccccp--------
ByteOrder=0
BitOrder=0
The BitMask value is applied bitwise to the binary data read from the card. Only f (facility code) and c(card number) characters in the BitMask have any meaning. Any other characters indicate that the corresponding bit is to be ignored.
Without an OutputFormat option, the bytes read from the card are first converted into a 64 bit integer value.
The ByteOrder option determines whether the first or last byte should be considered the most significant:
ByteOrder=0 means the first byte is the most significant.
ByteOrder=1 means the first byte is the least significant.
The BitOrder value may then be used to reverse the order of the bits in the resulting facility code and card number:
BitOrder=0 means that the leftmost character of the BitMask is matched to the most significant bit of the data.
BitOrder=1 means that the rightmost character of the BitMask is applied to the least significant bit of the data and that the bit order is reversed. (That is, the least significant bit is treated as the most significant in the resulting facility code and card number).
Note: Take care if setting both BitOrder and MaskAlignment at the same time, as both parameters reverse the alignment of the mask with the data. If BitOrder=1 and MaskAlignment=1 the alignment will be reversed twice, leaving the data and mask with the default left alignment.
So, for example, reading 6 bytes of data:
BytesToRead=6
The data read from the card is: C6 8B 06 92 48 14
ByteOrder=1
Reverses the byte order giving a 64 bit hex value of: 144892068BC6
In binary this is:
0001 0100 0100 1000 1001 0010 0000 0110 1000 1011 1100 0110
Matching this binary value to a BitMask and BitOrder then works as follows:
Using:
BitMask=-----pffffffffffffffcccccccccccccccccccp
BitOrder=0
The mask matches the data like this:
000101000100100010010010000001101000101111000110
-----pffffffffffffffcccccccccccccccccccp
So:
Facility code =00010010001001b = 489h = 1161 (decimal)
Card number = 0010000001101000101b = 10345h = 66373 (decimal)
The following options allow the facility code and/or card number to be formatted with leading zeros:
FACDigits=4
CardNumDigits=6
So using the above values the resulting facility code would be 0489, the card number would be 066373. The overall combined ID would be 0489066373.
As another example, consider the following BitMask with BitOrder=1 used on the same data:
BitMask=pcccccccccccccccccccffffffffffffffp
BitOrder=1
In this case we would get the following match:
000101000100100010010010000001101000101111000110
pcccccccccccccccccccffffffffffffffp
The BitMask is right-aligned with the data due to BitOrder=1. This option also reverses the bit order giving:
Facility code =11000111101000b = 31E8h = 12776 (decimal)
Card number = 1011000000100100100b = 58124h = 360740 (decimal)
In this case the FACDigits=4 and CardNumDigits=6 options will not cause any additional leading zeros to be added because the values are already contain at least this number of digits. The resulting combined ID will be 12776360740.
Droid SansDroid Sans BoldOpen SansOpen Sans BoldDroid Sans woffDroid Sans Bold woffOpen Sans woffOpen Sans Bold woff